<%@page import="DTO.UsuarioDTO" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8" session="true"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
	UsuarioDTO usuarioLogado = (UsuarioDTO) session.getAttribute("usuarioLogado");
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="../../livros/styles/styles.css" />
<script type="text/javascript" src="../../livros/js/view.js"></script>
<script type="text/javascript" src="../../livros/js/validacao.js"></script>

</head>
<body>
	<div id="top">
		<div id="cabecalho">
			<h1><a href="../../livros/" style="text-decoration: none; text-shadow: 0.08em 0.08em 0.08em #aaa; ">
			<span style="background: #F07746; border-radius: 6px; box-shadow: 2px 2px 4px #777 ;
				color: #fff; padding-left: 3px; padding-right: 3px; text-shadow: 1px 1px .5px #000">
			42</span>books</a></h1>
			
			<div id="searchBox">
				<div id="loginBox">
					<form action="HomeServlet" method="post">
						<%if(usuarioLogado == null){ %>
							<input type="text" name="login" id="login" class="botoesLogin" />
							<input type="password" name="senha" id="senha" class="botoesLogin" />
							<input type="submit" name="acao" id="acao" value="Logar" class="botoesLogin" />
						<%} else {%>
							<input type="submit" name="acao" id="acao" value="Deslogar" class="botoesLogin" style="float: right; ;" />
							<span style="font-size: 16px; float: right"><%=usuarioLogado.getLogin() %>:</span>
						<% } %>			
					</form>
				</div>
				
				<form action="HomeServlet" method="post" onsubmit="return validarPesquisaHome(this)">
					<input type="text" name="pesquisa" id="search" value="Pesquisar..." onfocus="searchFocus(this)" onblur="searchBlur(this)" />
					<div id="searchImage">
						<button type="submit" name="acao" value="Pesquisar" style="background: none; border: none; cursor: pointer; height: 100%; margin: 0px; padding: 0px; width: 100%">
							<img src="../../livros/img/search.png" />
						</button>
					</div>
					<input type="radio" id="radioAutor" name="pesquisaHome" value="autor" <% if(request.getParameter("pesquisaHome") != null && request.getParameter("pesquisaHome").equals("autor")) out.println("checked=\"checked\""); %> />
					<label for="radioAutor">Autor</label>
					<input type="radio" id="radioObra" id name="pesquisaHome" value="obra" <% if(request.getParameter("pesquisaHome") != null && request.getParameter("pesquisaHome").equals("obra")) out.println("checked=\"checked\""); %> />
					<label for="radioObra">Obra</label>
					<input type="radio" id="radioUsuario" name="pesquisaHome" value="usuario" <% if(request.getParameter("pesquisaHome") != null && request.getParameter("pesquisaHome").equals("usuario")) out.println("checked=\"checked\""); %> />
					<label for="radioUsuario">Usuário</label>
					<input type="radio" id="radioColecao" name="pesquisaHome" value="colecao" <% if(request.getParameter("pesquisaHome") != null && request.getParameter("pesquisaHome").equals("colecao")) out.println("checked=\"checked\""); %> />
					<label for="radioColecao">Coleção</label>
				</form>
			</div>								
		</div>
	</div>
		<div id="menuBar">
			<a href="HomeServlet?acao=Autor">Autores</a> |
			<a href="HomeServlet?acao=Obra">Obras</a> |
			<a href="HomeServlet?acao=Usuario">Usuários</a> |
			<a href="HomeServlet?acao=Colecao">Coleções</a> 
			<% if(usuarioLogado != null){%>| <a href="ListaServlet?acao=MinhaLista&id=<%=usuarioLogado.getCodigo()%>">Minha Lista</a><%} %>
		</div>
</body>
</html>